import request from '@/utils/request'
const paramsQuery = (params = {}) => {
    let result = [],
        key,
        value,
        i;
    for (key in params) {
        value = params[key];
        if (value instanceof Array) {
            for (i = value.length;i--;) {
                result.push(`${key}[]=${encodeURIComponent(value[i])}`);
            }
        } else {
            result.push(`${key}=${encodeURIComponent('undefined' === typeof value ? '' : value)}`);
        }
    }
    return result.join('&');
}

export function getTelegramList(data) {
    return request({
        url: '/telegram/group/list',
        method: 'get',
        params: data,
    })
}

export function telegramGroupAdd(data) {
    return request({
        url: '/telegram/group/add',
        method: 'post',
        params: data
    })
}
export function telegramGroupUpdate(data) {
    return request({
        url: '/telegram/group/edit',
        method: 'post',
        params: data
    })
}

export function telegramGroupDel(data) {
    return request({
        url: '/telegram/group/delete',
        method: 'post',
        params: data
    })
}


export function telegramGroupPushAdd(data) {
    return request({
        url: '/telegram/push/add',
        method: 'post',
        params: data
    })
}

export function telegramGroupPushDel(data) {
    return request({
        url: '/telegram/push/delete',
        method: 'post',
        params: data
    })
}



export function getTelegramDDList(data) {
    return request({
        url: '/telegram/forward/dd/page',
        method: 'get',
        params: data,
    })
}

export function telegramDDDel(data) {
    return request({
        url: '/telegram/forward/dd/delete',
        method: 'post',
        params: data
    })
}

// export function telegramDDGroupAdd(data) {
//     return request({
//         url: '/telegram/forward/dd/add',
//         method: 'post',
//         params: data,
//     })
// }
export function telegramDDGroupAdd(data) {
    return request.post('/telegram/forward/dd/add', data)
}
export function telegramDDGroupUpdate(data) {
    return request({
        url: '/telegram/forward/dd/update',
        method: 'post',
        params: data
    })
}
export function telegramDDGroupBind(data) {
    return request({
        url: '/telegram/forward/dd/bind',
        method: 'post',
        params: data
    })
}
export function telegramDDGroupUnbind(data) {
    return request({
        url: '/telegram/forward/dd/unbind',
        method: 'post',
        params: data
    })
}